package com.oa.controller.user;

import com.oa.pojo.Log;
import com.oa.service.user.LogService;
import com.oa.vo.PageResult;
import com.oa.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 一拳超人
 * @Date: 2021/10/10 17:17
 */
@CrossOrigin
@RestController
@RequestMapping("/user/log")
public class LogController {
    @Autowired
    private LogService logService;

    @GetMapping("/getOneselfList")
    public SysResult getOneselfList(PageResult pageResult) {
        return SysResult.success(logService.getOneselfList(pageResult));
    }

    @GetMapping("/getAuthorName")
    public SysResult getLogAuthorName(String empId) {
        return SysResult.success(logService.getLogAuthorInfo(empId));
    }

    @GetMapping("/getLogInfo")
    public SysResult getLogInfo(Log log) {
        return SysResult.success(logService.getLogInfo(log));
    }

    @PostMapping("/addNewLog")
    public SysResult addNewLog(@RequestBody Log log) {
        return SysResult.success(logService.addNewLog(log));
    }

    @DeleteMapping("/deleteLog/{id}")
    public SysResult deleteLog(Log log) {
        return SysResult.success(logService.deleteLog(log));
    }

    @PutMapping("/updateLogInfo")
    public SysResult updateLogInfo(@RequestBody Log log){
        return SysResult.success(logService.updateLogInfo(log));
    }
}
